// 查看记录
import { client } from '../../../request/index.js'
Page({
    data: {
        imgIp: getApp().globalData.imgIp,
        currentPageNum: 1,
        list: [],
        authPanelHidden: true,
        hasNextPage: true
    },

    onLoad: function() {
        this.req(1, 15);

    },
    async req(pageNum, pageSize) {
        const sessId = getApp().globalData.sessionid;
        const getData = await client({
            url: '/account-log/list?pageNum=' + pageNum + '&pageSize=' + pageSize,
            data: {
                pageNum: pageNum,
                pageSize: pageSize
            }
        })
        console.log('查看记录', getData);
        if (pageNum === 1 && getData.data.data.list.length === 0) {
            this.setData({
                authPanelHidden: false
            })
        } else {
            this.setData({
                list: this.data.list.concat(getData.data.data.list),
                hasNextPage: getData.data.data.hasNextPage
            })
        }

    },


    onPullDownRefresh: function() {

    },
    onReachBottom: function() {
        if (this.data.hasNextPage) {
            let currentPageNum = this.data.currentPageNum + 1;
            this.setData({
                currentPageNum: currentPageNum
            })
            this.req(currentPageNum, 10);
        }
    },
    onShareAppMessage: function() {

    }
})